package com.test2015.Swing.render.jlistrender;
import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.event.*;

import java.util.*;
import java.awt.image.BufferedImage;
import java.io.*;
/**
 * @author Hardneedl
 */
class ImageListModel implements ListModel {
    private java.util.List L = new ArrayList(0);
    
    ImageListModel() {
    	try {
			String name = "photo";
			for(int i=2;i<6;i++){
				String tmpName = name+i+".jpg"; 
				BufferedImage read = ImageIO.read(ImageListModel.class.getResourceAsStream(tmpName));
				ImageIcon icon = new ImageIcon(read);
				L.add(icon);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
    }

	public int getSize() {
		return L.size();
	}

	public Object getElementAt(int index) {
		return L.get(index);
	}

	public void addListDataListener(ListDataListener l) {
	}

	public void removeListDataListener(ListDataListener l) {
	}
}